/// [Digit fifth powers](https://projecteuler.net/problem=30)
/// 9.pow(5)     = 59049
/// 9.pow(5) * 6 = 354294
fn main() {
    for l in &[4, 5] {
        let mut e = 1 as u32;
        while 9_u32.pow(*l) * e > 10_u32.pow(e) {
            e += 1;
        }
        let mut sum_all = 0;
        for num in 2..(9_u32.pow(*l) * e) {
            let mut sum = 0;
            for s in num.to_string().chars() {
                if let Some(x) = s.to_digit(10) {
                    sum += x.pow(*l);
                }
            }
            if sum == num {
                sum_all += sum;
            }
        }
        println!("{}:{}", l, sum_all);
    }
}
